***Efectos en otros outcomes

clear
set more off

use "$basein/Datos adicionales/Primaria_indicadores_getsion.dta"
append using "$basein/Datos adicionales/PrimariaINDI_indicadores_getsion.dta"


rename cv_cct cct

/*
************************
**Base de enumeradores**
************************

merge 1:1 cct using "$basein/Datos adicionales/Enumeradores.dta", gen(_pp)

keep if _pp==3

*/

*********************
**Base de controles**
*********************

rename  cct school_id

merge 1:1 school_id using "$basein/Datos adicionales/base_Contraste.dta", gen(planea)

keep if planea==3

**********************
***Base experimento***
**********************

merge m:1 school_id using "$basein/Datos adicionales/Experimento_id.dta", gen(experimento)

keep if experimento==3

******************
***Base estrato***
******************

merge m:1 school_id using "$basein/Datos adicionales/estratos.dta", gen(_estratos)

keep if _estratos==3

******************
***KEEP´ONLY PEC VS PEC PLUS******
******************

drop if state==10
drop if treatgroup2=="Control"


*************************************
***Genero variables de tratamiento***
*************************************

gen PEC_PLUS=0
replace PEC_PLUS=1 if treatgroup2=="PEC Plus"

gen PEC=0
replace PEC=1 if treatgroup2=="PEC"

label var PEC_PLUS "Pec plus"

label var PEC "Pec"


***PEC PLUS vs. PEC***
eststo clear
eststo:  reghdfe aprob PEC_PLUS   if treatgroup!="Control" & state!=10, a(estrato)  vce(cluster school_id)
estadd ysumm
sum aprob if e(sample)==1 & PEC_PLUS==0
estadd scalar ymean2=r(mean)
eststo:  reghdfe repite PEC_PLUS   if treatgroup!="Control" & state!=10, a(estrato)  vce(cluster school_id)
estadd ysumm
sum repite if e(sample)==1 & PEC_PLUS==0
estadd scalar ymean2=r(mean)
eststo:  reghdfe tot_estu PEC_PLUS   if treatgroup!="Control" & state!=10, a(estrato)  vce(cluster school_id)
estadd ysumm
sum tot_estu if e(sample)==1 & PEC_PLUS==0
estadd scalar ymean2=r(mean)

esttab using "$tables/Resultados_eficiencia_1.tex" ,  fragment se ar2 nocon nonumber nomtitles nolines nogaps /// 
replace collabels(none) ///
keep(PEC_PLUS) coef(none) stats(N ymean2, fmt("%9.2gc" "%9.2fc") labels("No. of obs." "Control mean")) star(* 0.10 ** 0.05 *** 0.01)

	
